<?php

namespace common\models\kingdee;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\kingdee\PersonPosition;

/**
 * PersonPositionSearch represents the model behind the search form about `common\models\kingdee\PersonPosition`.
 */
class PersonPositionSearch extends PersonPosition
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['FID', 'FJOINDATE', 'FQUITDATE', 'FFORMALDATE', 'FCREATORID', 'FCREATETIME', 'FLASTUPDATEUSERID', 'FLASTUPDATETIME', 'FPERSONID', 'FJOINGROUPDATE', 'FBASEDATE', 'FHRORGUNITID', 'FCONTROLUNITID', 'FJOBGRADE', 'FENTERDATE', 'FLEFTDATE', 'FPERSONDEP', 'FJOBLEVELID', 'FJOBSTARTDATE', 'FZHUANYJSZW', 'FPRIMARYPOSITIONID', 'FHIGHESTDEGREEDATE', 'FJOBGRADEENDDATE', 'FGKADMINID', 'FHIGHESTPDEGREEID', 'FOLDPERSONDEPID', 'FJOINSYSTEMDATE', 'FENROLLSOURCEID', 'FRETIREDATE', 'FZDY1', 'FZDY2', 'FZDY3', 'FZDY4', 'FZDY5', 'FZDY6', 'FZDY7', 'FZDY8', 'FZDY9', 'FZDY10', 'FZDY11', 'FZDY12', 'FZDY13', 'FZDY14', 'FZDY15', 'FZDY16', 'FZDY17', 'FZDY22', 'FZDY23', 'FZDY24', 'FZDY25', 'FDIMISSIONREASONID', 'FEFFDT', 'FLEFFDT', 'FHISTORYRELATEID', 'FLABCONTRACTFIRSTPARTY', 'FJOBSEQUENCEID'], 'safe'],
            [['FTRYOUTMONTH', 'FWORKTIME', 'FISENROLLAGAIN', 'FISHAVEWORK', 'FISHIGHEST', 'FISADMIN', 'FISTECH', 'FISIMPT', 'FZDY20', 'FZDY21', 'FZDY26', 'FISLEADER'], 'integer'],
            [['FJOINGROUPYEARS', 'FJOINCOMPANYYEARS', 'FJOINBASEYEARS', 'FADJUSTSYSVALUE', 'FADJUSTWORKVALUE', 'FADJUSTCOVALUE', 'FADJUSTGROUPVAL', 'FSYSSERVICEYEARS', 'FZDY18', 'FZDY19', 'FNEWWORKTIME', 'FEXTWORKTIME', 'FLENOFACTUALSERVICE'], 'number'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = PersonPosition::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'FJOINDATE' => $this->FJOINDATE,
            'FTRYOUTMONTH' => $this->FTRYOUTMONTH,
            'FQUITDATE' => $this->FQUITDATE,
            'FFORMALDATE' => $this->FFORMALDATE,
            'FCREATETIME' => $this->FCREATETIME,
            'FLASTUPDATETIME' => $this->FLASTUPDATETIME,
            'FJOINGROUPDATE' => $this->FJOINGROUPDATE,
            'FBASEDATE' => $this->FBASEDATE,
            'FJOINGROUPYEARS' => $this->FJOINGROUPYEARS,
            'FJOINCOMPANYYEARS' => $this->FJOINCOMPANYYEARS,
            'FJOINBASEYEARS' => $this->FJOINBASEYEARS,
            'FWORKTIME' => $this->FWORKTIME,
            'FENTERDATE' => $this->FENTERDATE,
            'FLEFTDATE' => $this->FLEFTDATE,
            'FISENROLLAGAIN' => $this->FISENROLLAGAIN,
            'FJOBSTARTDATE' => $this->FJOBSTARTDATE,
            'FISHAVEWORK' => $this->FISHAVEWORK,
            'FISHIGHEST' => $this->FISHIGHEST,
            'FHIGHESTDEGREEDATE' => $this->FHIGHESTDEGREEDATE,
            'FJOBGRADEENDDATE' => $this->FJOBGRADEENDDATE,
            'FISADMIN' => $this->FISADMIN,
            'FISTECH' => $this->FISTECH,
            'FJOINSYSTEMDATE' => $this->FJOINSYSTEMDATE,
            'FADJUSTSYSVALUE' => $this->FADJUSTSYSVALUE,
            'FADJUSTWORKVALUE' => $this->FADJUSTWORKVALUE,
            'FADJUSTCOVALUE' => $this->FADJUSTCOVALUE,
            'FADJUSTGROUPVAL' => $this->FADJUSTGROUPVAL,
            'FSYSSERVICEYEARS' => $this->FSYSSERVICEYEARS,
            'FRETIREDATE' => $this->FRETIREDATE,
            'FISIMPT' => $this->FISIMPT,
            'FZDY9' => $this->FZDY9,
            'FZDY10' => $this->FZDY10,
            'FZDY11' => $this->FZDY11,
            'FZDY12' => $this->FZDY12,
            'FZDY13' => $this->FZDY13,
            'FZDY14' => $this->FZDY14,
            'FZDY18' => $this->FZDY18,
            'FZDY19' => $this->FZDY19,
            'FZDY20' => $this->FZDY20,
            'FZDY21' => $this->FZDY21,
            'FZDY26' => $this->FZDY26,
            'FNEWWORKTIME' => $this->FNEWWORKTIME,
            'FEXTWORKTIME' => $this->FEXTWORKTIME,
            'FLENOFACTUALSERVICE' => $this->FLENOFACTUALSERVICE,
            'FEFFDT' => $this->FEFFDT,
            'FLEFFDT' => $this->FLEFFDT,
            'FISLEADER' => $this->FISLEADER,
        ]);

        $query->andFilterWhere(['like', 'FID', $this->FID])
            ->andFilterWhere(['like', 'FCREATORID', $this->FCREATORID])
            ->andFilterWhere(['like', 'FLASTUPDATEUSERID', $this->FLASTUPDATEUSERID])
            ->andFilterWhere(['like', 'FPERSONID', $this->FPERSONID])
            ->andFilterWhere(['like', 'FHRORGUNITID', $this->FHRORGUNITID])
            ->andFilterWhere(['like', 'FCONTROLUNITID', $this->FCONTROLUNITID])
            ->andFilterWhere(['like', 'FJOBGRADE', $this->FJOBGRADE])
            ->andFilterWhere(['like', 'FPERSONDEP', $this->FPERSONDEP])
            ->andFilterWhere(['like', 'FJOBLEVELID', $this->FJOBLEVELID])
            ->andFilterWhere(['like', 'FZHUANYJSZW', $this->FZHUANYJSZW])
            ->andFilterWhere(['like', 'FPRIMARYPOSITIONID', $this->FPRIMARYPOSITIONID])
            ->andFilterWhere(['like', 'FGKADMINID', $this->FGKADMINID])
            ->andFilterWhere(['like', 'FHIGHESTPDEGREEID', $this->FHIGHESTPDEGREEID])
            ->andFilterWhere(['like', 'FOLDPERSONDEPID', $this->FOLDPERSONDEPID])
            ->andFilterWhere(['like', 'FENROLLSOURCEID', $this->FENROLLSOURCEID])
            ->andFilterWhere(['like', 'FZDY1', $this->FZDY1])
            ->andFilterWhere(['like', 'FZDY2', $this->FZDY2])
            ->andFilterWhere(['like', 'FZDY3', $this->FZDY3])
            ->andFilterWhere(['like', 'FZDY4', $this->FZDY4])
            ->andFilterWhere(['like', 'FZDY5', $this->FZDY5])
            ->andFilterWhere(['like', 'FZDY6', $this->FZDY6])
            ->andFilterWhere(['like', 'FZDY7', $this->FZDY7])
            ->andFilterWhere(['like', 'FZDY8', $this->FZDY8])
            ->andFilterWhere(['like', 'FZDY15', $this->FZDY15])
            ->andFilterWhere(['like', 'FZDY16', $this->FZDY16])
            ->andFilterWhere(['like', 'FZDY17', $this->FZDY17])
            ->andFilterWhere(['like', 'FZDY22', $this->FZDY22])
            ->andFilterWhere(['like', 'FZDY23', $this->FZDY23])
            ->andFilterWhere(['like', 'FZDY24', $this->FZDY24])
            ->andFilterWhere(['like', 'FZDY25', $this->FZDY25])
            ->andFilterWhere(['like', 'FDIMISSIONREASONID', $this->FDIMISSIONREASONID])
            ->andFilterWhere(['like', 'FHISTORYRELATEID', $this->FHISTORYRELATEID])
            ->andFilterWhere(['like', 'FLABCONTRACTFIRSTPARTY', $this->FLABCONTRACTFIRSTPARTY])
            ->andFilterWhere(['like', 'FJOBSEQUENCEID', $this->FJOBSEQUENCEID]);

        return $dataProvider;
    }
}
